class Solution { public: intjump(vector<int>& nums){ int current = 0; int count = 0; while(current < nums.size() - 1) { count++; if(current + nums[current] >= nums.size() - 1) { break; } int distance = 0; int index = current + 1; int begin = current + 1; int end = current + nums[current]; for(int i = begin; i <= end; i++) { if(nums[i] + i > distance) { distance = nums[i] + i; index = i; } } current = index; } return count; } };